/**
 * Title:        流程基本信息表签出检测
 * Company:      泛微软件
 */


package checkDetail;

import general.BaseBean;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONObject;

import weaver.general.GCONST;
import weaver.general.OrderProperties;
import weaver.general.Util;
import weaver.system.ThreadWorkTimer;
import weaver.system.WrokflowOverTimeTimer;



public class WorkflowIseditCheck extends BaseBean implements CheckBase  {

    @Override
    public JSONObject checkData(HashMap dataMap) {
        setRecordSet();
        (new BaseBean()).writeLog("WorkflowIseditCheck  start");

        recordSet.executeSql(" select count(1) as cnt from workflow_base where isedit = 1 or editor > 0 ");
        String result = "";
        List resultList = new ArrayList();
        if(recordSet.next() && recordSet.getInt("cnt") > 0){
            result = resultNeedFix;
            resultList.add("一共有" + recordSet.getInt("cnt") + "条流程需要修复。");
        }else{
            result = resultOk;
        }
        (new BaseBean()).writeLog("WorkflowIseditCheck  end");
        return formatReturnJsonCheck(result, resultList,this);
    }

    @Override
    public JSONObject fixData(HashMap dataMap) {
        setRecordSet();
        recordSet.executeUpdate(" update workflow_base set isedit = null,editor = null where isedit = 1 or editor > 0 ");
        needReload = "1";
        return checkData(dataMap);
    }

    @Override
    public String getClassName() {
        return "流程基本信息表签出检测";
    }


    @Override
    public String getClassDesc() {
        // TODO Auto-generated method stub
        return "检测是否存在流程迁出后不保存直接关闭页面的情况，导致流程被迁出，无法编辑的情况。";
    }

}



